<!DOCTYPE html>
<html class="x-admin-sm">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>新增专家</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport"
          content="width=device-width,user-scalable=yes, minimum-scale=0.4, initial-scale=0.8,target-densitydpi=low-dpi" />
    <link rel="stylesheet" href="./css/font.css">
    <link rel="stylesheet" href="./css/xadmin.css">
    <script src="./js/jquery.min.js"></script>
    <script type="text/javascript" src="./lib/layui/layui.js"
            charset="utf-8"></script>
    <script type="text/javascript" src="./js/xadmin.js"></script>

    <!-- 让IE8/9支持媒体查询，从而兼容栅格 -->
    <!--[if lt IE 9]>
    <script src="https://cdn.staticfile.org/html5shiv/r29/html5.min.js"></script>
    <script src="https://cdn.staticfile.org/respond.js/1.4.2/respond.min.js"></script>
    <![endif]-->
</head>
<body>
<div class="layui-fluid">
    <div class="layui-row">
        <form class="layui-form">
            <div class="layui-form-item">
                <label for="id" class="layui-form-label"> <span
                        class="x-red">*</span>专家id
                </label>
                <div class="layui-input-inline">
                    <input type="text" id="id" name="id" lay-verify="id"
                           readonly autocomplete="off" class="layui-input">
                </div>
                <div class="layui-form-mid layui-word-aux">
                    <span class="x-red">*</span>
                </div>
            </div>
            <div class="layui-form-item">
                <label for="professorName" class="layui-form-label"> <span
                        class="x-red">*</span>专家姓名
                </label>
                <div class="layui-input-inline">
                    <input type="text" id="professorName" name="professorName" lay-verify="professorName"
                           required="required" autocomplete="off" class="layui-input">
                </div>
                <div class="layui-form-mid layui-word-aux">
                    <span class="x-red">*</span>
                </div>
            </div>
            <div class="layui-form-item">
                <label for="gender" class="layui-form-label">
                    性别
                </label>
                <div class="layui-input-inline" style="margin-top: 8px;">
                    <input type="checkbox" id="gender" name="gender" lay-skin = "switch" lay-text = "男|女" checked="checked" lay-filter = "gender" class="layui-input" />
                </div>
            </div>
            <div class="layui-form-item">
                <label for="birthday" class="layui-form-label">
                    出生年月
                </label>
                <div class="layui-input-inline">
                    <input  id="birthday" name="birthday"
                            lay-verify="birthday" autocomplete="off" class="layui-input">
                </div>
            </div>
            <div class="layui-form-item">
                <label for="identityNumber" class="layui-form-label">
                    身份证号
                </label>
                <div class="layui-input-inline">
                    <input type="text" id="identityNumber" name="identityNumber"
                           lay-verify="identityNumber" autocomplete="off" class="layui-input">
                </div>
            </div>
            <div class="layui-form-item">
                <label for="workStatus" class="layui-form-label">
                    工作状态
                </label>
                <div class="layui-input-inline">
                    <select name="workStatus" id="workStatus">

                    </select>

                </div>
            </div>
            <div class="layui-form-item">
                <label for="institution" class="layui-form-label">
                    毕业院校
                </label>
                <div class="layui-input-inline">
                    <input type="text" id="institution" name="institution"
                           lay-verify="institution" autocomplete="off" class="layui-input">
                </div>
            </div>
            <div class="layui-form-item">
                <label for="education" class="layui-form-label">
                    学历
                </label>
                <div class="layui-input-inline">
                    <select name="education" id="education">

                    </select>

                </div>
            </div>
            <div class="layui-form-item">
                <label for="major" class="layui-form-label">
                    专业
                </label>
                <div class="layui-input-inline">
                    <input type="text" id="major" name="major"
                           lay-verify="major" autocomplete="off" class="layui-input">
                </div>
            </div>
            <div class="layui-form-item">
                <label for="employCompany" class="layui-form-label">
                    工作单位
                </label>
                <div class="layui-input-inline">
                    <input type="text" id="employCompany" name="employCompany"
                           lay-verify="employCompany" autocomplete="off" class="layui-input">
                </div>
            </div>
            <div class="layui-form-item">
                <label for="administrative" class="layui-form-label">
                    行政职务
                </label>
                <div class="layui-input-inline">
                    <select id="administrative" name="administrative">

                    </select>

                </div>
            </div>
            <div class="layui-form-item">
                <label for="technicalPost" class="layui-form-label">
                    技术职称
                </label>
                <div class="layui-input-inline">
                    <select id="technicalPost" name="technicalPost">

                    </select>

                </div>
            </div>
            <div class="layui-form-item">
                <label for="telephone" class="layui-form-label">
                    固定电话
                </label>
                <div class="layui-input-inline">
                    <input type="telephone" id="telephone" name="phone"
                           lay-verify="telephone" autocomplete="off" class="layui-input">
                </div>
            </div>
            <div class="layui-form-item">
                <label for="mobliePhone" class="layui-form-label">
                    手机号
                </label>
                <div class="layui-input-inline">
                    <input type="text" id="mobliePhone" name="mobliePhone"
                           lay-verify="mobliePhone" autocomplete="off" class="layui-input">
                </div>
            </div>
            <div class="layui-form-item">
                <label for="address" class="layui-form-label">
                    所在地址
                </label>
                <div class="layui-input-inline">
                    <input type="text" id="address" name="address" placeholder="可以通过下方的选择或者直接输入"
                           lay-verify="address" autocomplete="off" class="layui-input">
                </div>
                <!-- start-->
                <div class="layui-form-item x-city" id="end">
                    <!--<label class="layui-form-label">所在地址</label>-->
                    <div class="layui-input-inline">
                        <select name="province" id="province" lay-filter="province">
                            <option value="">请选择省</option>
                        </select>
                    </div>
                    <div class="layui-input-inline">
                        <select name="city" id="city" lay-filter="city">
                            <option value="">请选择市</option>
                        </select>
                    </div>
                    <div class="layui-input-inline">
                        <select name="area" id="area" lay-filter="area">
                            <option value="">请选择县/区</option>
                        </select>
                    </div>
                </div>

                <!-- end -->
            </div>
            <div class="layui-form-item">
                <label for="projectCategory" class="layui-form-label">
                    评审项目类型
                </label>
                <div class="layui-input-inline">
                    <input type="text" id="projectCategory" name="projectCategory"
                           lay-verify="projectCategory" autocomplete="off" class="layui-input">
                </div>
            </div>
            <div class="layui-form-item">
                <label for="workDate" class="layui-form-label"> <span
                        class="x-red"></span>工作年限
                </label>
                <div class="layui-input-inline">
                    <input type="number" min="0" id="workDate" name="workDate"
                           lay-verify="workDate" autocomplete="off" class="layui-input">
                </div>
            </div>

            <div class="layui-form-item">
                <label  class="layui-form-label"></label>
                <label  class="layui-form-label"></label>
                <button class="layui-btn" lay-filter="xiugai" id="fanhui">返回</button>
            </div>
        </form>
    </div>
</div>

<script type="text/javascript" src="./js/xcity.js"></script>
<script>


    layui.use([ 'form', 'laydate','layer', 'jquery','code'],
        function() {
            var $ = layui.jquery;
            form = layui.form;
            var layer = layui.layer;
            var laydate=layui.laydate;

            //
            //传默认值
            $('#end').xcity('安徽','合肥市','包河区');

            //
            laydate.render({
                elem : '#birthday' //指定元素
                ,trigger: 'click'
            });
            var $role=$("#workStatus");
            $.get("js/param.json",function(data){
                $.each(data.workStatus,function(i,d){
                    $role.append(new Option(d,d));
                });
                form.render();//重绘表单
            });
            var $xueli=$("#education");
            $.get("js/param.json",function(data){
                $.each(data.education,function(i,d){
                    $xueli.append(new Option(d,d));
                });
                form.render('select');//重绘表单
            });
            var administrative=$("#administrative");
            $.get("js/param.json",function(data){
                $.each(data.administrative,function(i,d){
                    administrative.append(new Option(d,d));
                });
                form.render('select');//重绘表单
            });
            var technicalPost=$("#technicalPost");
            $.get("js/param.json",function(data){
                $.each(data.technicalPost,function(i,d){
                    technicalPost.append(new Option(d,d));
                });
                form.render('select');//重绘表单
            });

            function initAddr(){

                var p=$("#province").val();
                var c=$("#city").val();
                var area=$("#area").val();
                $("#address").val(p+" "+c+" "+area);
                form.render();
            }

            //截取该专家id
            var id=window.location.search.substring(1);
            /*   alert(id);*/
            $.getJSON("searchoneperson",{id:id},function (d) {
                for(i in d.data){
                    $("#"+i).val(d.data[i]);
                }
                $("#gender").attr("checked",d.data.sex=='男');

                form.render();//重绘表单

            });






            //自定义验证规则
            form.verify({

                professorName : function(value) {
                    if (value.length < 2||value.length >12) {
                        return '用户名必须是2-12个字符';
                    }
                },
                identityNumber : [ /\d{17}(\d|X)$/, '身份证必须是18位' ]

            });

            $("fanhui").click(function () {
                      xadmin.close();
                      xadmin.close();
            });


        });
</script>

</body>

</html>